package com.smart.test.proxy.advice;

import org.aopalliance.intercept.MethodInvocation;

/**
 * @auther a123
 * @create 2018-08-14 20:27
 * @desc 实现环绕增强
 */
public class GreetingRunAdvice implements org.aopalliance.intercept.MethodInterceptor {


    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        Object[] args = methodInvocation.getArguments();
        String clientName = (String)args[0];
        System.out.println("How are you! Mr. " + clientName + ".");

        Object object = methodInvocation.proceed();
        System.out.println("please enjoy yourself!");

        return object;
    }
}
